import axios from '../../../utils/http'
// 查询角色 role/teacher?
export async function getListData(parameter) {
  const {
    data
  } = await axios.get('/cms/role?' + parameter)
  return data
}
// 增加角色teacher/role
export async function addRole(name, remark) {
  const {
    data
  } = await axios.post('/cms/role', {
    authDataList: [],
    name: name,
    remark: remark,
  })
  return data
}

// 删除角色
export async function deleteRole(roleIdList) {
  const {
    data
  } = await axios.delete('/cms/role', {
    data: {
      roleIdList: roleIdList,
    }


  })
  return data
}

// 修改角色
export async function updataRole(authDataList, id, name, remark) {
  const {
    data
  } = await axios.put('/cms/role', {

    id: id,
    authDataList: authDataList,
    ifFast: false,
    name: name,
    remark: remark,



  })
  return data
}

// 当前角色权限查询/cms/permission/tree
export async function getRoleAuthority(parameter) {
  const {
    data
  } = await axios.get('/cms/role/' + parameter)
  return data
}

// 获取全部权限
export async function getAllAuthority() {
  const {
    data
  } = await axios.get('/cms/permission/tree')
  return data
}


// 查询用户 role/teacher?
export async function getTeacheData(parameter) {
  const {
    data
  } = await axios.get('/cms/role/teacher?' + parameter)
  return data
}


// 增加用户角色teacher/role
export async function addTeacherRole(id, roleId) {
  const {
    data
  } = await axios.post('/cms/user/role', {

    id: id,
    'ifFast': true,
    roleId: roleId,
  })
  return data
}


// 删除用户角色
export async function deleteTeacherRole(id, roleId) {
  const {
    data
  } = await axios.delete('/cms/user/role', {
    data: {
      id: id,
      'ifFast': true,
      roleId: roleId,
    }


  })
  return data
}
